package com.kgcx.common.utils;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

public class RequestParamUtil {
	
	/**
	 * 获取请求参数中所有的信息
	 * 
	 * @param request
	 * @return
	 * @throws UnsupportedEncodingException 
	 */
	public static Map<String, String> getAllRequestParam(final HttpServletRequest request) throws UnsupportedEncodingException {
		Map<String, String> res = new HashMap<String, String>();
		Enumeration<?> temp = request.getParameterNames();
		if (null != temp) {
			while (temp.hasMoreElements()) {
				String en = (String) temp.nextElement();
				String value = request.getParameter(en);
				if (null == value || "".equals(value.trim())) {
					continue;
				}
				res.put(en, value);
			}
		}
		return res;
	}
}
